In an electric compressor driven by an electric motor included therein, a hermetic terminal is used as a member for supplying electric power from outside of a housing to the electric motor and for maintaining airtightness in the housing. For example, Patent Document 1 describes an electric compressor which comprises a housing, and the hermetic terminal is assembled into an opening passing through the housing. The opening includes a large-diameter portion located at the side closer to the outside of the housing and a small-diameter portion located at the side closer to the inside of the housing. The hermetic terminal is locked to a shoulder portion corresponding to a boundary between the large-diameter portion and the small-diameter portion. An O-ring for maintaining airtightness in the housing is provided between the shoulder portion and the hermetic terminal, and the hermetic terminal is fixed by installing two circlips with the O-ring in the compressed state.